//
//  GHCrakTableViewCell.m
//  GodHorses
//
//  Created by Mac on 2017/11/16.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "GHCrakTableViewCell.h"
@interface GHCrakTableViewCell()

@property(nonatomic, strong) STLabel                         *nameLabel;
@property(nonatomic, strong) STLabel                         *zhihangLabel;
@property(nonatomic, strong) STLabel                         *cardLabel;
@property(nonatomic, strong) STLabel                         *nickNameLabel;
@end
@implementation GHCrakTableViewCell

+ (CGFloat)CellHeight{
    return 140;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
#pragma mark --subView
- (void)configSubView{
    
    self.backgroundColor = [UIColor whiteColor];
    self.nameLabel = [[STLabel alloc] initWithFrame:CGRectMake(10, 14, UIScreenWidth - 20, 20)
                                                     text:@"----"
                                                textColor:GH_firstTextColor
                                                     font:13
                                              isSizetoFit:NO
                                            textAlignment:NSTextAlignmentLeft];
    [self addSubview:self.nameLabel];
    [self.nameLabel st_showBottomLine];
    
    self.zhihangLabel = [[STLabel alloc] initWithFrame:CGRectMake(10, self.nameLabel.bottom, UIScreenWidth - 20, 20)
                                               text:@"----"
                                          textColor:GH_firstTextColor
                                               font:13
                                        isSizetoFit:NO
                                      textAlignment:NSTextAlignmentLeft];
    [self addSubview:self.zhihangLabel];
    [self.zhihangLabel st_showBottomLine];
    
    self.cardLabel = [[STLabel alloc] initWithFrame:CGRectMake(10, self.zhihangLabel.bottom, UIScreenWidth - 20, 20)
                                                  text:@"----"
                                             textColor:GH_firstTextColor
                                                  font:13
                                           isSizetoFit:NO
                                         textAlignment:NSTextAlignmentLeft];
    [self addSubview:self.cardLabel];
    [self.cardLabel st_showBottomLine];
    
    self.nickNameLabel = [[STLabel alloc] initWithFrame:CGRectMake(10, self.cardLabel.bottom, UIScreenWidth - 20, 20)
                                               text:@"----"
                                          textColor:GH_firstTextColor
                                               font:13
                                        isSizetoFit:NO
                                      textAlignment:NSTextAlignmentLeft];
    [self addSubview:self.nickNameLabel];
    [self.nickNameLabel st_showBottomLine];
    
    
    self.defultButton = [[STButton alloc] initWithFrame:CGRectMake(10, _nickNameLabel.st_bottom + 10, 100, 24)
                                                  title:@"默认银行卡"
                                             titleColor:GH_secendTextColor
                                              titleFont:12
                                           cornerRadius:0
                                        backgroundColor:nil
                                        backgroundImage:nil
                                                  image:[UIImage imageNamed:@"PC_gouxuan_background"]];
    self.defultButton.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
    [self.defultButton setImage:[UIImage imageNamed:@"PC_gouxuan__selected_red"] forState:UIControlStateSelected];
    [self addSubview:self.defultButton];
    
    self.delButton = [[STButton alloc] initWithFrame:CGRectMake(10, _nickNameLabel.st_bottom + 10, 80, 24)
                                               title:@"删除"
                                          titleColor:GH_secendTextColor
                                           titleFont:12
                                        cornerRadius:0
                                     backgroundColor:nil
                                     backgroundImage:nil
                                               image:[UIImage imageNamed:@"img_mine_address_del"]];
    self.delButton.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
    self.delButton.st_right = UIScreenWidth - 10;
    [self addSubview:self.delButton];
    

}
- (void)setModel:(GHBankModel *)model{
    _model = model;
    self.nameLabel.text = [NSString stringWithFormat:@"[银行名称]%@",model.bank_name];
    self.nameLabel.attributedText = [self.nameLabel.text st_convertAttributeStringWithKeyWord:@"[银行名称]" attributes:@{NSForegroundColorAttributeName:GH_redColor}];
    
    self.zhihangLabel.text = [NSString stringWithFormat:@"[支行名称]%@",model.branch_name];
    self.zhihangLabel.attributedText = [self.zhihangLabel.text st_convertAttributeStringWithKeyWord:@"[支行名称]" attributes:@{NSForegroundColorAttributeName:GH_redColor}];
    
    self.cardLabel.text = [NSString stringWithFormat:@"[银行卡号]%@",model.account_bank];
    self.cardLabel.attributedText = [self.cardLabel.text st_convertAttributeStringWithKeyWord:@"[银行卡号]" attributes:@{NSForegroundColorAttributeName:GH_redColor}];
    
    self.nickNameLabel.text = [NSString stringWithFormat:@"[提现姓名]%@",model.account_name];
    self.nickNameLabel.attributedText = [self.nickNameLabel.text st_convertAttributeStringWithKeyWord:@"[提现姓名]" attributes:@{NSForegroundColorAttributeName:GH_redColor}];
    
    self.defultButton.selected = model.isdefault;
    
}
@end
